void npc(Player @player, NPC @npc) {
int state = npc.getState();
int type = npc.getSelected();
npc.setVariable("type", type);
if(state == 0) {
if(player.getItemAmount(4031712) >= 1 || player.getItemAmount(4031713) >= 1) {
npc.addText("Here's the ticket reader. You will be brought in immediately. Which ticket would you like to use?\r\n#b#L0#Kerning City (Normal)#l#k");
npc.sendSimple();
} else {
npc.addText("Here's the ticket reader. You are not allowed in without the ticket.");
npc.sendOK();
npc.end();
}
}
else if(state == 1) {
if(type == 0 && ((getMinute()%10 >= 1 && getMinute()%10 <= 3) || (getMinute()%10 >= 6 && getMinute()%10 <= 8))) {
npc.addText("It looks like there's plenty of room for this ride. Please have your ticket ready so I can let you in. The ride will be long, but you'll get to your destination just fine. What do you think? Do you want to get on this ride?");
npc.sendYesNo();
}
else if(type == 0 && (getMinute()%10 == 4 || getMinute()%10 == 9)) {
npc.addText("The subway for Kerning City is getting ready for takeoff. I'm sorry, but you'll have to get on the next ride. The ride schedule is available through the usher at the ticketing booth.");
npc.sendNext();
npc.end();
} else {
npc.addText("We will begin boarding 1 minutes before the takeoff. Please be patient and wait for a few minutes. Be aware that the ship will take off right on time, and we stop receiving tickets 1 minute before that, so please make sure to be here on time.");
npc.sendNext();
npc.end();
}
}
else if(state == 2) {
if(npc.getSelected() == YES) {
player.changeMap(600010002);
} else {
npc.addText("You must have some business to take care of here, right?");
npc.sendNext();
}
npc.end();
}
}